
import VueRouter from 'vue-router';

const routes = [
    {
        path:'/',
        name:'login',
        component:()=>import('../components/Login')
    },
    {
        path:'/register',
        name:'register',
        component:()=>import('../components/register')
    },
    {
        path:'/Index',
        name:'index',
        component:()=>import('../components/Index'),
        children:[
            {
                path:'/Home',
                name:'home',
                meta:{
                    title:'首页'
                },
                component:()=>import('../components/Home')
            },
            {
                path: '/NextPage', // 添加 :typeId 来接收参数
                name: 'NextPage',
                meta: {
                    title: '属性列表参数列表'
                },
                component: () => import('../components/product/NextPage')
            },
            {
                path: '/product2',
                name: 'ProductCatagory',
                meta: {
                    title: '查看下级'
                },
                component: () => import('../components/product/ProductCatagory')
            },
            {
                path: '/Product4',
                name: 'ProductAdd',
                meta: {
                    title: '添加商品'
                },
                component: () => import('../components/product/ProductAdd')
            },
            {
                path: '/OrderDetail',
                name: 'OrderDetail',
                meta:{
                    title:'订单详情'
                },
                component:() => import('../components/order/OrderDetail.vue')
            }
            /*{
                path:'/Admin',
                name:'admin',
                meta:{
                    title:'管理员管理'
                },
                component:()=>import('../components/admin/AdminManage.vue')
            },
            {
                path:'/User',
                name:'user',
                meta:{
                    title:'用户管理'
                },
                component:()=>import('../components/user/UserManage.vue')
            },*/
        ]
    }
]

const router = new VueRouter({
    mode:'history',
    routes
})

export function resetRouter() {
    router.matcher = new VueRouter({
        mode:'history',
        routes: []
    }).matcher
}
const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (to) {
    return VueRouterPush.call(this, to).catch(err => err)
}
export  default router;